Code and Data for ``Online Planning in Non-stationary Environments''

This repository contains code and data for the research paper titled ``Online Planning in Non-stationary Environments''. The work includes four numerical experiments, including (1) online coupon assignment with multiple objectives, (2) order fulfillment problem with service level requirements, (3) resource allocation with hard constraints, and (4) resource allocation with soft constraints. The code and data are provided in four different folders. We describe the code and simulation environments for each numerical experiment below.

(1) Online coupon assignment with multiple objectives (Section 5.1)
Environment: Python + gurobi solver
Python file: ``main_online_coupon_assignment.ipynb''
This file is used to implement different policies to solve the coupon assignment problem.
Data: ``Training_Sample.csv''; ``Testing_Sample.csv''
The ``Training_Sample.csv'' is used to calibrate different polices, while the ``Testing_Sample.csv'' is used to generate the out-of-sample simulation environments to compare the performance of different policies.
Due to the Non-disclosure agreement, we provide a list of sample data for illustration.

(2) Order fulfillment problem with service level requirements (Section 5.2)
Environment: Java + gurobi solver
Java file: 
``main_order_fulfillment.java'': This file is used to implement different policies to solve the order fulfillment problem. The following four java files are required to get the fulfillment network information.
``readDistance.java'': This file is used to obtain the shipping distance between the fulfillment center and demand region. The data is provided in ``shippingdistance.txt'' in the ``SourceData'' folder.
``readGCGnodistance.java'': This file is used to obtain the GCG network structure (without considering the shipping distance when designing the network). The structure is retrieved from Xu et al. (2020). The data is provided in ``GCGnodistance.txt'' in the ``SourceData'' folder.
``readGCGwithdistance.java'': This file is used to obtain the revised GCG network structure (with considering the shipping distance when designing the network). The data is provided in ``GCGdistance.txt' in the ``SourceData'' folder.
``readScalematrix.java'': This file is used to obtain the shipping distance between the fulfillment center and demand region. The data is provided in ``dedicatedsystem.txt'' in the ``SourceData'' folder.
SourceData: ``shippingdistance.txt''; ``GCGnodistance.txt''; ``GCGnodistance.txt''; ``readScalematrix.java''

(3) Resource allocation with hard constraints (Section 4.3)
Environment: Python + gurobi solver
Python file: ``main_resource_allocation.ipynb''
This file is used to implement different policies to solve the resource allocation problem with (hard) budget constraints. There are four allocation policies to be implement in this file. The hindsight optimal policy is implemented after knowing the actual scenario. The O2O policy is our solution. The IGD policy is implemented with using the distribution/sample information, while the UGD policy is implemented without using the distribution/sample information. Both policies are developed by Jiang et al. (2024).

(4) Resource allocation with soft constraints (Appendix D)
Environment: Matlab + gurobi solver
Matlab file:
``main_capacity_pooling.m'': This file is used to implement different policies to solve the resource allocation problem with (soft) service level requirements. There are four allocation policies to be called in this file. We provide the four policies in separate files below.
``O2O_Policy.m'': The O2O policy developed in this paper.
``SAA_Capacity.m'': The sample-average-approximation policy. 
``ZZCT_Policy.m'': The allocation policy, developed by Zhong et al. (2018), is used to solve the allocation problem in stationary environments. This the first benchmark policy in this case.
``Restart_ZZCT_Policy.m'': We revise the ZZCT policy by re-starting the ``debt'' updating process when the demand distribution changes. This is the second benchmark policy in this case.


Please refer to the respective files and data for detailed implementations and experiments in each case.

Reference

Jiang, Jiashuo, Xiaocheng Li, Jiawei Zhang. 2024. Online stochastic optimization with wasserstein based non-stationarity. Management Science.
Xu, Zhen, Hailun Zhang, Jiheng Zhang, Rachel Q Zhang. 2020. Online demand fulfillment under limited flexibility. Management Science 66(10) 4667–4685.
Zhong, Yuanguang, Zhichao Zheng, Mabel C Chou, Chung-Piaw Teo. 2018. Resource pooling and allocation policies to deliver differentiated service. Management Science 64(4) 1555–1573.